/**************************************************
Do-file replicating all tables in:
Open access to data: An ideal professed but not practised
published in: Research Policy 
Volume 43, Issue 9, November 2014, Pages 1621�1633
Authors: Patrick Andreoli-Versbach & Frank Mueller-Langer 
**************************************************/

	clear all
	set more off
	
********************
** Set up globals **
********************           
	 
	 
	global folder  [insert path where excel file has been saved]
	
	/* Example: 
	global folder "C:\Users\Desktop\Replication"
	*/
	
	display "$folder"

	cd "$folder"
	
	import excel "$folder\Replication raw data - DataSharing - PAV&FML 2014.xls", sheet("Sheet1") firstrow

	
// Label 
label var  Share_ArchWeb "VolDataSharing" 
label var tenure "Tenure"
label var log_AvCit "Log Average Citations"
label var Sha_man_paper_perc "Mandatory Data-Disclosure"
label var BS "Business School"
label var Uni_policy_sum "Inst. Data Policy"
label var share_othBin "Share other Material"
label var top5_perc "% Top-5 Papers (Econ.)"
label var experience "Experience"
label var exp_sq "Experience Squared"
label var res_grants "No. of Research Grants"
label var male "Male" 
label var USA_empl "USA empl." 
label var EU_emp "EU empl."

// Save STATA format
save "$folder\Replication data - DataSharing - PAV&FML 2014.dta" , replace

// Define Locals	
local struct " share_othBin "	
local cont1 " tenure  log_AvCit Sha_man_paper_perc BS Uni_policy_sum  "
local cont2 "  top5_perc experience exp_sq res_grants "
local cont3 " male USA_empl EU_empl "
local dep1 Share_ArchWeb
local dep2 Sha_man_paper_perc

****** Table 1: Summary Statistics *******
	
reg `dep1' `dep2' `struct' `cont1'   `cont2'   `cont3' 
outreg2 using Tab1_SumStat, sum replace st( mean p50 sd  min max N) excel side lab


****** Table 2: Voluntary Data-Sharing ******

oprobit `dep1' `struct' `cont1'  
outreg2 using Tab2,  replace excel  symbol(***, **, *) lab
oprobit `dep1' `struct' `cont1'   `cont2'   
outreg2 using Tab2, append excel  symbol(***, **, *) lab
oprobit `dep1' `struct' `cont1'   `cont2'   `cont3' 
outreg2 using Tab2, append excel  symbol(***, **, *) lab
oprobit `dep1'  `cont1'   `cont2'   `cont3'  
outreg2 using Tab2, append excel  symbol(***, **, *) lab
 
// Define Locals 	
local struct " share_othBin "	
local cont1 " tenure  log_AvCit BS Uni_policy_sum  "
local cont2 "  top5_perc experience exp_sq res_grants "
local cont3 " male USA_empl EU_empl "
local dep1 Share_ArchWeb
local dep2 Sha_man_paper_perc

****** Table 3: Mandatory Data-Disclosure ******

*2) "Share_other"
reg `dep2' `struct' `cont1'  
outreg2 using Tab3, replace excel  symbol(***, **, *) lab 
reg `dep2' `struct' `cont1'   `cont2'  
outreg2 using Tab3, append excel  symbol(***, **, *) lab
reg `dep2' `struct' `cont1'   `cont2'   `cont3' 
outreg2 using Tab3, append excel  symbol(***, **, *)  lab
reg `dep2'  `cont1'   `cont2'  `cont3' 
outreg2 using Tab3, append excel  symbol(***, **, *) lab




**************************** // END // **************************************
